Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
timeout-abort-controller
Advanced tools
An AbortController that aborts after a specified timeout.
timeout-abort-controller
uses retimer
internally to help reduce the impact of having numerous timers running.
npm install timeout-abort-controller
const { AbortController } = require('native-abort-controller')
const { TimeoutController } = require('timeout-abort-controller')
const anySignal = require('any-signal')
const userController = new AbortController()
// Aborts after 1 second
const timeoutController = new TimeoutController(1000)
const combinedSignal = anySignal([userController.signal, timeoutController.signal])
combinedSignal.addEventListener('abort', () => console.log('Abort!'))
// The user or the timeout can now abort the action
await performSomeAction({ signal: combinedSignal })
timeoutController.clear()
new TimeoutController(ms)
Creates an AbortController
compliant TimeoutController
.
Name | Type | Description |
---|---|---|
ms | number | The time in milliseconds for when the TimeoutController should abort |
timeoutController.clear()
Clears the internal timer.
timeoutController.abort()
Aborts the controller and clears the internal timeout.
timeoutController.reset()
Clears the timer and sets the internal timeout to occur after the ms
timeout it was created with.
abort-controller
native-abort-controller
any-signal
Combines an array of AbortSignals into a single signal.MIT © Jacob Heun
FAQs
An AbortController that aborts after a specified timeout
The npm package timeout-abort-controller receives a total of 53,702 weekly downloads. As such, timeout-abort-controller popularity was classified as popular.
We found that timeout-abort-controller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.